package com.example.service;

import com.example.constants.RabbitConts;
import com.example.model.vo.CodeVo;
import com.example.untils.EmailUntil;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class EmailService {
    @Autowired
    private EmailUntil emailUntil;
    @RabbitHandler
    @RabbitListener(queues = RabbitConts.EMAIL_QUEUES)
    public void hello(CodeVo codeVo)
    {

        emailUntil.sendEmail(codeVo.getEmail(),codeVo.getCode().toString());
    }
}
